import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Element from 'element-ui'
import axios from 'axios'
import JsonViewer from 'vue-json-viewer'
import CodeEditor from 'bin-code-editor';
import mavonEditor from 'mavon-editor'

import "element-ui/lib/theme-chalk/index.css"
import 'mavon-editor/dist/css/index.css'

import "./axios"
import "./permission"
import "./dateutil"

//el-select 懒加载
import directives from './directives'

// import dateutil from './dateutil'

// 全局注册指令
Vue.use(directives)

Vue.use(Element)
Vue.use(mavonEditor)
Vue.use(JsonViewer)
Vue.use(CodeEditor);
// Vue.use(dateutil)
//todo 为什么要加这句话？？？ 导致后面直接报错了。。。
//axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';

Vue.config.productionTip = false
Vue.prototype.$axios = axios

let ishttps = 'https:' == document.location.protocol ? true : false;
let constantUrl = ishttps?"https://www.debusiness.cn":"http://47.98.252.4";
// let constantUrl = "http://localhost:8087"
// if(ishttps){
//   alert('https');
// }else{
//   alert('http');
// }

const http_php = axios.create({
  timeout: 10000 * 12,
  baseURL: constantUrl,
  headers: {
    'X-Requested-With': 'XMLHttpRequest'
  }
})
Vue.prototype.$http_php = http_php

const http_java = axios.create({
  timeout: 10000 * 12,
  baseURL: constantUrl+"/do_mdd",
  // baseURL: constantUrl,
  headers: {
    'X-Requested-With': 'XMLHttpRequest'
  }
})
Vue.prototype.$http_java = http_java

// Vue.dateutil = dateutil

// export {dateutil}

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

